//
//  BaseViewController.m
//  FastMedical
//
//  Created by 李通 on 16/7/6.
//  Copyright © 2016年 chivalrous. All rights reserved.
//

#import "BaseViewController.h"
#import "UIViewController+JASidePanel.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = WHITE_COLOR;
    self.navigationController.navigationBar.barTintColor = kThemeColor;
    
    [self setupLeftButtonItem];
}

- (void)setupLeftButtonItem
{
    
    UIButton *leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    
    [leftBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    
    [leftBtn addTarget:self action:@selector(goingBack) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
}

#pragma mark - 点击返回到指定页面
- (void)goingBack
{
    
    [self.navigationController popViewControllerAnimated:YES];
}


//  ***********************【 侧滑 】**********************
/** 中间的nav */
- (UINavigationController *)centerNavigationController
{
    
    return (UINavigationController *)self.sidePanelController.centerPanel;;
}

/** 左侧VC */
- (UIViewController *)leftMenuViewController
{
    
    return self.sidePanelController.leftPanel;
}

- (void)jumpToOtherViewController:(UIViewController *)otherVC
{
    
    //显示中间的panel
    [self.sidePanelController showCenterPanelAnimated:YES];
    
    //push到指定的VC
    [[self centerNavigationController] pushViewController:otherVC animated:NO];
}

//  ***********************【 侧滑 】**********************

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
